﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Web.UI.WebControls;
using Cn.Cellula.Model.Content;
using Cn.Edwon.Biz;

namespace Cn.Cellula.Biz.Port {
    public interface IDeptBiz:IBiz {
        TSysDeptEO LoadByName(String rName,  String rOwnerKey);
        /// <summary>
        /// 根据父ID获取分类列表
        /// </summary>
        /// <param name="parentKey"></param>
        /// <returns></returns>
        IList<TSysDeptEO> LoadCategories(String rOwnerKey,  String parentKey);
        /// <summary>
        /// 将分类列表转换为json格式
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        String LoadDept2Json(String rOwnerKey,  String parentKey);
        /// <summary>
        /// 将分类中从某个节点开始以下子孙都转换为json数据
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        String ParseNode2Json(XmlNode node);
        /// <summary>
        /// 将分类转化为优结构的xml格式
        /// </summary>
        /// <param name="firstId"></param>
        /// <returns></returns>
        XmlDocument LoadDept2XHtml(String rOwnerKey,  String parentKey);
        /// <summary>
        /// 将分类转化为下拉列表的集合
        /// </summary>
        /// <param name="rPrefix">层级菜单的前缀字符串</param>
        /// <param name="rSelfKey">自身节点ID，在选择时列表将过滤掉自己</param>
        /// <param name="rSelected"></param>
        /// <returns></returns>
        IList<ListItem> LoadDept2ListItem(String rOwnerKey,  String rPrefix, String rSelfKey, Boolean rSelected);
        /// <summary>
        /// 将分类转化为下拉列表的集合
        /// </summary>
        /// <param name="rDoc"></param>
        /// <param name="rPrefix">层级菜单的前缀字符串</param>
        /// <param name="rSelfKey">自身节点ID，在选择时列表将过滤掉自己</param>
        /// <param name="rSelected"></param>
        /// <returns></returns>
        IList<ListItem> LoadDept2ListItem(XmlDocument rDoc, String rPrefix, String rSelfKey, Boolean rSelected);
        /// <summary>
        /// 获取当前分类的Path
        /// </summary>
        /// <param name="rDoc"></param>
        /// <param name="rDeptId"></param>
        /// <returns></returns>
        IList<TSysDeptEO> LoadDeptPath(String rOwnerKey,  String rDeptId);
        IList<TSysDeptEO> LoadDeptPath(XmlDocument doc, String rDeptId);
        /// <summary>
        /// 获取当前分类的Path
        /// </summary>
        /// <param name="rDoc"></param>
        /// <param name="rDeptId"></param>
        /// <returns></returns>
        String LoadDeptPath(String rOwnerKey,  String rDeptId, String rSeparate);
        /// <summary>
        /// 删除分类
        /// </summary>
        /// <param name="rKeys"></param>
        void DeleteCategories(String[] rKeys, String rOwnerKey);
        /// <summary>
        /// 删除分类
        /// </summary>
        /// <param name="rKeys"></param>
        void DeleteCategories(IList<String> rKeys, String rOwnerKey);
        /// <summary>
        /// 获取子孙节点的ID集合
        /// </summary>
        /// <param name="rOwnerKey">属主Key</param>
        /// <param name="rKey">调用者的部门Key</param>
        /// <returns></returns>
        IList<String> LoadDescendantsKeys(String rOwnerKey,  String rKey);

        string LoadDept2JskitMenuXml( String rUrl, Boolean rAllOption, String rAllText);
        /// <summary>
        /// 将Dept列表转换成JskitRichDropDownList使用json数据
        /// </summary>
        /// <param name="rOwnerKey"></param>
        /// <param name="rTypeKey"></param>
        /// <param name="parentKey"></param>
        /// <returns></returns>
        String LoadDept2JskitDdl(String rOwnerKey,  String parentKey);
        /// <summary>
        /// 将eo转换成JskitRichDropDownList使用json数据
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        String ParseNode2JskitDdlItem(XmlNode node);
    }
}
